home *** CD-ROM | disk | FTP | other *** search
/ isnet Internet / Isnet Internet CD.iso / prog / hiz / 09 / 09.exe / adynware.exe / perl / lib / site / Win32 / AdminMisc.pm next >
Encoding:
Perl POD Document  |  1999-12-28  |  3.8 KB  |  190 lines

  1. package Win32::AdminMisc;
  2.  
  3. $VERSION = '0.03';
  4.  
  5.  
  6. require Exporter;
  7. require DynaLoader;
  8.  
  9. die "The Win32::AdminMisc module works only on Windows NT" if(!Win32::IsWinNT() );
  10.  
  11. @ISA= qw( Exporter DynaLoader );
  12. @EXPORT = qw(
  13.     FILTER_TEMP_DUPLICATE_ACCOUNT
  14.     FILTER_NORMAL_ACCOUNT
  15.     FILTER_INTERDOMAIN_TRUST_ACCOUNT
  16.     FILTER_WORKSTATION_TRUST_ACCOUNT
  17.     FILTER_SERVER_TRUST_ACCOUNT
  18.     UF_TEMP_DUPLICATE_ACCOUNT
  19.     UF_NORMAL_ACCOUNT
  20.     UF_INTERDOMAIN_TRUST_ACCOUNT
  21.     UF_WORKSTATION_TRUST_ACCOUNT
  22.     UF_SERVER_TRUST_ACCOUNT
  23.     UF_MACHINE_ACCOUNT_MASK
  24.     UF_ACCOUNT_TYPE_MASK
  25.     UF_DONT_EXPIRE_PASSWD
  26.     UF_SETTABLE_BITS
  27.     UF_SCRIPT
  28.     UF_ACCOUNTDISABLE
  29.     UF_HOMEDIR_REQUIRED
  30.     UF_LOCKOUT
  31.     UF_PASSWD_NOTREQD
  32.     UF_PASSWD_CANT_CHANGE
  33.     USE_FORCE
  34.     USE_LOTS_OF_FORCE
  35.     USE_NOFORCE
  36.     USER_PRIV_MASK
  37.     USER_PRIV_GUEST
  38.     USER_PRIV_USER
  39.     USER_PRIV_ADMIN
  40. );
  41.  
  42. =head1 NAME
  43.  
  44. Win32::AdminMisc - manage network groups and users in perl
  45.  
  46. =head1 SYNOPSIS
  47.  
  48.     use Win32::AdminMisc;
  49.  
  50. =head1 DESCRIPTION
  51.  
  52. This module offers control over the administration of groups and users over
  53. a network.
  54.  
  55. =head1 FUNCTIONS
  56.  
  57. =head2 NOTE:
  58.  
  59. All of the functions return FALSE (0) if they fail, unless otherwise noted.
  60. server is optional for all the calls below. (if not given the local machine
  61. is assumed.)
  62.  
  63. =over 10
  64.  
  65. =item UserGetAttributes(server, userName, password, passwordAge, privilege, homeDir, comment, flags, scriptPath)
  66.  
  67. Gets password, passwordAge, privilege, homeDir, comment, flags, and
  68. scriptPath for user.
  69.  
  70. =item UserSetAttributes(server, userName, password, passwordAge, privilege, homeDir, comment, flags, scriptPath)
  71.  
  72. Sets password, passwordAge, privilege, homeDir, comment, flags, and
  73. scriptPath for user.
  74.  
  75. =item UserChangePassword(domainname, username, oldpassword, newpassword)
  76.  
  77. Changes a users password. Can be run under any account.
  78.  
  79. =item UsersExist(server, userName)
  80.  
  81. Checks if a User exists.
  82.  
  83. =item GetUsers(server, filter, \@userArray)
  84.  
  85. Fills userArray with the all of the User names.
  86.  
  87. =item GroupCreate(server, group, comment)
  88.  
  89. Creates a group.
  90.  
  91. =item GroupDelete(server, group)
  92.  
  93. Deletes a group.
  94.  
  95. =item GroupGetAttributes(server, groupName, comment)
  96.  
  97. Gets the comment.
  98.  
  99. =item GroupSetAttributes(server, groupName, comment)
  100.  
  101. Sets the comment.
  102.  
  103. =item GroupAddUsers(server, groupName, users)
  104.  
  105. Adds a user to a group.
  106.  
  107. =item GroupDelUsers(server, groupName, users)
  108.  
  109. Deletes a users from a group.
  110.  
  111. =item GroupIsMember(server, groupName, user)
  112.  
  113. Returns TRUE if user is a member of groupName.
  114.  
  115. =item GroupGetMembers(server, groupName, \@userArray)
  116.  
  117. Fills userArray with the members of groupName.
  118.  
  119. =item LocalGroupCreate(server, group, comment)
  120.  
  121. Creates a local group.
  122.  
  123. =item LocalGroupDelete(server, group)
  124.  
  125. Deletes a local group.
  126.  
  127. =item LocalGroupGetAttributes(server, groupName, comment)
  128.  
  129. Gets the comment.
  130.  
  131. =item LocalGroupSetAttributes(server, groupName, comment)
  132.  
  133. Sets the comment.
  134.  
  135. =item LocalGroupIsMember(server, groupName, user)
  136.  
  137. Returns TRUE if user is a member of groupName.
  138.  
  139. =item LocalGroupGetMembers(server, groupName, \@userArray)
  140.  
  141. Fills userArray with the members of groupName.
  142.  
  143. =item LocalGroupAddUsers(server, groupName, users)
  144.  
  145. Adds a user to a group.
  146.  
  147. =item LocalGroupDelUsers(server, groupName, users)
  148.  
  149. Deletes a users from a group.
  150.  
  151. =back
  152.  
  153. =cut
  154.  
  155. sub AUTOLOAD {
  156.  
  157.     local($constname);
  158.     ($constname = $AUTOLOAD) =~ s/.*:://;
  159.     $!=0;
  160.     $val = constant($constname, @_ ? $_[0] : 0);
  161.     if ($! != 0) {
  162.     if ($! =~ /Invalid/) {
  163.         $AutoLoader::AUTOLOAD = $AUTOLOAD;
  164.         goto &AutoLoader::AUTOLOAD;
  165.     }
  166.     else {
  167.         ($pack,$file,$line) = caller;
  168.         die "Your vendor has not defined Win32::AdminMisc macro $constname, used in $file at line $line.";
  169.     }
  170.     }
  171.     eval "sub $AUTOLOAD { $val }";
  172.     goto &$AUTOLOAD;
  173. }
  174.  
  175. bootstrap Win32::AdminMisc;
  176.  
  177. 1;
  178. __END__
  179.  
  180.     
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.